package com.zmovie.framework.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zmovie.framework.domain.MovieType;
import com.zmovie.framework.service.MovieTypeService;
import com.zmovie.framework.mapper.MovieTypeMapper;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * @author lenovo
 * @description 针对表【movie_type】的数据库操作Service实现
 * @createDate 2023-11-30 12:26:47
 */
@Service
public class MovieTypeServiceImpl extends ServiceImpl<MovieTypeMapper, MovieType>
        implements MovieTypeService {

    @Override
    public List<MovieType> listMovieTypes(MovieType movieType) {
        LambdaQueryWrapper<MovieType> wrapper = new LambdaQueryWrapper<>();
        wrapper.like(movieType.getName() != null, MovieType::getName, movieType.getName());
        wrapper.orderByAsc(MovieType::getId);
        return list(wrapper);
    }

    @Override
    public List<MovieType> listNotIn(List<Integer> typeIds) {
        LambdaQueryWrapper<MovieType> wrapper = new LambdaQueryWrapper<>();
        wrapper.notIn(MovieType::getId, typeIds);
        return list(wrapper);
    }
}




